/*
 * key.h
 *
 *  Created on: Oct 13, 2025
 *      Author: Administrator
 */

#ifndef INC_KEY_H_
#define INC_KEY_H_

#ifdef __cplusplus
extern "C"{
#endif

#include "main.h"
#include "stdint.h"

#define READ_S1()      HAL_GPIO_ReadPin(S1_GPIO_Port,S1_Pin)
#define READ_S2()      HAL_GPIO_ReadPin(S2_GPIO_Port,S2_Pin)
#define READ_S3()      HAL_GPIO_ReadPin(S3_GPIO_Port,S3_Pin)
#define READ_S4()      HAL_GPIO_ReadPin(S4_GPIO_Port,S4_Pin)
#define READ_S1_BIT3()  (READ_S1()<<3)
#define READ_S2_BIT2()	((!READ_S2())<<2)
#define READ_S3_BIT1()	((!READ_S3())<<1)
#define READ_S4_BIT0()  (!READ_S4())
#define READ_KEY_BITS() READ_S1_BIT3()|READ_S2_BIT2()|READ_S3_BIT1()|READ_S4_BIT0()

extern uint8_t Key_Scan(uint8_t mode);

#ifdef __cplusplus
}
#endif



#endif /* INC_KEY_H_ */
